from django.urls import path, re_path
from app01 import views
from rest_framework.routers import DefaultRouter, SimpleRouter

urlpatterns = [
#     # path('books/', views.BookAPIView.as_view()),
#     path('books/', views.BookInfoModelViewSet.as_view(actions={'get': 'list', 'post': 'create'})),
#     path('books/<pk: int>/', views.BookInfoModelViewSet.as_view(actions={'get': 'retrieve', 'put': 'update', 'delete': 'delete'})),
#     # 根据阅读量来获取书籍
#     path('books/bbread/', views.BookInfoModelViewSet.as_view(actions={'get': 'bbread_book'})),
#     re_path('books/bbread/(?P<pk>\d+)/$', views.BookInfoModelViewSet.as_view(actions={'get': 'bbread_book', 'put': 'update_book_bread'}))
    path('test/', views.TestExceptionView.as_view(), name='test')
]

router = DefaultRouter()
router.register('books', viewset=views.BookInfoModelViewSet, basename='books')

urlpatterns += router.urls

print(urlpatterns)







